package com.sky.controller.user;

import com.sky.result.Result;
import com.sky.service.UserService;
import com.sky.vo.UserLoginVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.Map;

@Api(tags = "C端-用户接口")
@RestController
@RequestMapping("/user/user")
public class UserController {
    @Autowired
    private UserService userService;

    /**
     * 登录
     * @param mapParan
     * @return
     * @throws IOException
     */
    @ApiOperation("登录")
    @PostMapping("/login")
    public Result<UserLoginVO> wxLogin(@RequestBody Map<String,String> mapParan) throws IOException {
        UserLoginVO code = userService.wxlogin(mapParan.get("code"));
        return  Result.success(code);
    }
}
